from django.db import models


class Product(models.Model):
    name = models.CharField(max_length=200, verbose_name='商品名称')
    price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='商品价格')
    description = models.TextField(blank=True, null=True, verbose_name='商品描述')
    image = models.ImageField(upload_to='product_images/', blank=True, null=True, verbose_name='商品图片')
    created_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    updated_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        verbose_name = '商品'
        verbose_name_plural = '商品'
        ordering = ['id']

    def __str__(self):
        return self.name
